<?php 
    $selected_album=array(
    'table_name'=>'doggy_albums',
    'key_field' => 'id',
    'value_field' => 'title',
    'where'=>array('account_id'=>$account_id),
    'init_data'=>array('key'=>'','name'=>'Select album'),
    );
    $title_album=isset($title_album)?$title_album:"";
?>

<div align="left" id="title_view_profile" >MON GALERIE</div>
<div id="post_wall" style="padding-top: 8px;padding-bottom:10px">
    <a id="link2" class="active" href="#">AJOUTER ALBUM</a> &nbsp; <a id="link1" href="#">ENVOYER PHOTO</a>
    <div id="photo_upload" style="display: none;">
        <?php 
            $attributes = array('class' => 'upload_image', 'id' => 'upload_image');
            echo form_open_multipart('image/upload_image', $attributes);
        ?>
        <table align="center">
            <tr>
                <td><label for="image_upload">Image : </label></td>
                <td><input type="file" name="userfile" size="20" /></td>
            </tr>
            <tr>
                <td><label for="image_title">Titre d'image :</label></td>
                <td><input type="text" name="image_title" id="image_title" size="35"/></td>
            </tr>
            <tr>
                <td><label for="image_title">Album :</label></td>
                <td><?php echo form_dropdown('album',dropdown_data($selected_album),'style="width:150px;"')?></td>
            </tr>

            <tr>
                <td></td> <td colspan="2"><input type="submit" name="submit_upload_image" id="submit_upload_image" value="Partager"/></td>
            </tr>
        </table>
        </form>
    </div>
    <div class="wall_sms">
        <?php  echo form_open('image/add_album');?>
        <table align="center">
            <tr>
                <td><label for="image_upload" style="color: white;">Title : </label></td>
                <td style="color: white;"><input type="text" name="title" size="35"  value="<?php echo set_value('title') ?>"/>
                    <?php echo form_error('title') ?>
                </td>
            </tr>
          
            <tr>
                <td></td> <td colspan="2"><input type="submit" name="add" id="add" value="Add"/></td>
            </tr>
        </table>
        </form>
    </div>
    </div>
<?php echo form_open('image/get_image_by_album_title')?>
<table width="70%">
    <tr>
        <td><a href="<?php echo site_url('image/get_image_shared') ?>">Share Photos</a>
       <?php echo form_dropdown('album',dropdown_data($selected_album),$title_album,'style="width:150px;"')?>
        <!--<td><a href="">Private Photo</a></td>-->
       <input type="submit" name="submit" id="submit" value="Select"/></td>
    </tr>
    <tr>
    <tr>
        <td>
            <table>
                <?php for($i=0;$i<count($image_galery);$i++): ?>
                    <?php $aRow=$image_galery[$i] ;?>
                    <?php $image_path = './upload_photo/' . $aRow['image'];
                        if (file_exists($image_path) && $aRow['image']!=null) {
                            $image_path = base_url() . 'upload_photo/' . $aRow['image'];
                            $image_path_full = base_url() . 'upload_photo/' . $aRow['image'];
                        } else {
                             $image_path = base_url() . 'assets/noimage.gif';
                            $image_path_full = base_url() . 'assets/noimage.gif';
                        }
                    ?>
                    <?php if($i%3==0): ?>
                        <tr>
                    <?php endif?>
                        <td>
                        <a href="<?php echo $image_path_full?>" id="example5" title="">
                        <img src="<?php echo $image_path ?>" alt="" border="0" width="90"></td>
                        <?php if($i%3==2): ?>
                        </tr>
                        <?php endif; ?>
                    <?php endfor; ?>
            </table>
            <?php if(isset($title_album)) {?>
            <div align="center"><?php echo $pagination;?></font></div>
            <?php }?>
        </td>
    </tr>
</table>
</form>
 